import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Course from '../components/Course.vue'
import Bwf from '../views/Bwf.vue'
import Html from '../views/Html.vue'
import Css from '../views/Css.vue'
import Hc from '../views/Hc.vue'
import Clist from '../views/Clist.vue'

Vue.use(VueRouter)

//路由规则
const routes = [{
    redirect: '/course',
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/course',
    component: Course,
    //重定向
    // redirect: '/css',//路径
    redirect: 'html', //路由规则名称
    children: [{
      path: '/html',
      name: 'html',
      component: Html
    }, {
      path: '/css',
      name: 'css',
      component: Css
    }, {
      name: 'hc',
      path: '/hc/:name/:price',
      component: Hc,
      props: true
    }]
  },
  {
    path: '/bwf',
    component: Bwf
  },
  {
    path: '/clist',
    name: 'Clist',
    component: Clist
  }
]

const router = new VueRouter({
  routes
})

export default router
